/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 *
 * @author ronald
 */
@Entity
@Table(name = "laundry_request_laundry_payment")
public class LaundryRequestLaundryPayment extends BaseObject {
    
    private Long id;
    private Double amount;
    private LaundryRequest laundryRequest;
    private PaymentsLaundry paymentsLaundry;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "id_laundryrequest_laundrypayment")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "amount")
    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_payment_laundry", nullable = false)
    public PaymentsLaundry getPaymentsLaundry() {
        return paymentsLaundry;
    }

    public void setPaymentsLaundry(PaymentsLaundry paymentsLaundry) {
        this.paymentsLaundry = paymentsLaundry;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_laundry_request", nullable = false)
    public LaundryRequest getLaundryRequest() {
        return laundryRequest;
    }

    public void setLaundryRequest(LaundryRequest laundryRequest) {
        this.laundryRequest = laundryRequest;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
                .append(this.id).append(this.amount)
                .toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final LaundryRequestLaundryPayment other = (LaundryRequestLaundryPayment) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.amount != other.amount && (this.amount == null || !this.amount.equals(other.amount))) {
            return false;
        }
        if (this.laundryRequest != other.laundryRequest && (this.laundryRequest == null || !this.laundryRequest.equals(other.laundryRequest))) {
            return false;
        }
        if (this.paymentsLaundry != other.paymentsLaundry && (this.paymentsLaundry == null || !this.paymentsLaundry.equals(other.paymentsLaundry))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 53 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 53 * hash + (this.amount != null ? this.amount.hashCode() : 0);
        hash = 53 * hash + (this.laundryRequest != null ? this.laundryRequest.hashCode() : 0);
        hash = 53 * hash + (this.paymentsLaundry != null ? this.paymentsLaundry.hashCode() : 0);
        return hash;
    }

}
